/**
 * react-bnb-gallery (https://github.com/peterpalau/react-bnb-gallery)
 * Licensed under MIT (https://github.com/peterpalau/react-bnb-gallery/blob/master/LICENSE)
 */

@keyframes GalleryLoadingSpinner {
  0% {
    -webkit-transform: rotate(0deg);
    transform: rotate(0deg);
  }

  100% {
    -webkit-transform: rotate(360deg);
    transform: rotate(360deg);
  }
}

.loading-spinner {
  margin: 60px auto;
  position: relative;
  border-top: 0.35em solid rgba(255, 255, 255, 0.2);
  border-right: 0.35em solid rgba(255, 255, 255, 0.2);
  border-bottom: 0.35em solid rgba(255, 255, 255, 0.2);
  border-left: 0.35em solid #fff;
  border-radius: 100%;
  width: 6em;
  height: 6em;

  &::after {
    width: 6em;
    height: 6em;
    border-radius: 100%;
  }
}

.loading-spinner,
.gallery-figcaption--thumbnails .caption-thumbnails ul.thumbnails-list li button.thumbnail-button::after {
  font-size: 10px;
  text-indent: -9999em;
  transform: translateZ(0);
  animation: GalleryLoadingSpinner 1.1s infinite linear;
}

.mode-light .loading-spinner {
  border-top-color: rgba(0, 0, 0, 0.1);
  border-right-color: rgba(0, 0, 0, 0.1);
  border-bottom-color: rgba(0, 0, 0, 0.1);
  border-left-color: #111;
}

.gallery-modal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2000;

  .gallery-modal--overlay {
    background-color: rgba(0, 0, 0, 1);
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    right: 0;
    bottom: 0;
    z-index: 0;
  }
}

.gallery-modal--preload {
  display: none;
}

.gallery-modal--container {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  overflow-y: auto;
  transform: translate3d(0, 0, 0);
  z-index: 1;
}

.gallery-modal--table {
  display: table;
  table-layout: fixed;
  height: 100%;
  width: 100%;
}

.gallery-modal--cell {
  display: table-cell;
  height: 100%;
  width: 100%;
  vertical-align: middle;
}

.gallery-modal--content {
  position: relative;
  overflow: hidden;
  border-radius: 2px;
  margin-left: auto;
  margin-right: auto;
  background-color: transparent;
  height: 100%;
  max-width: 100%;
}

.gallery-content {
  display: table;
  width: 100%;
  height: 100%;
}

.gallery-top {
  display: table-row;
}

.gallery-top--inner {
  padding: 60 15px 20;
}

.gallery {
  display: table-cell;
  vertical-align: middle;
  font-size: 1rem;
  width: 100%;
  padding-bottom: 10;

  ul.gallery-images--ul li.gallery-media-photo.loading .loading-spinner,
  ul.gallery-images--ul li.gallery-media-photo .picture.loading .loading-spinner {
    position: absolute;
    z-index: 1001;
    top: 50%;
    left: 50%;
    margin: -1.5rem 0 0 -1.5rem; /* visually centered */
    transform: translate(-50%, -50%);
  }

  .gallery-main {
    position: relative;
    z-index: 9;
  }

  .gallery-photos {
    width: 100%;
    max-width: 105vh;
    margin: 0 auto;

    .gallery-empty {
      color: #fff;
      font-size: 1.45rem;
      display: block;
      text-align: center;
      padding: 25% 0;
    }
  }

  .gallery-photo {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 75%;
  }

  .gallery-photo--current {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }

  ul.gallery-images--ul {
    position: relative;
    height: 100%;
    list-style-type: none;
    margin: 0;
    padding: 0;

    li.gallery-media-photo {
      opacity: 1;
      z-index: 2;

      .picture {
        background-color: transparent;
        cursor: pointer;
        position: absolute;
        width: 100%;
        height: 100%;

        img.photo {
          max-height: 100%;
          max-width: 100%;
          position: absolute;
          top: 50%;
          right: 0;
          bottom: 0;
          left: 0;
          margin: 0 auto;
          z-index: 0;
          border-radius: 6px;
          transform: translateY(-50%);
          box-shadow: 0 0.6rem 1rem rgba(#000, 0.25);
        }

        @media (max-width: 900px) {
          img.photo {
            max-width: 95%;
          }
        }
      }

      button.photo-button {
        display: block;
        background: none;
        border-width: 0;
        cursor: pointer;
        padding: 0 !important;
        -webkit-appearance: button;

        &:active,
        &:focus {
          outline: none;
          border-width: 0;
        }
      }
    }
  }

  .gallery-control {
    cursor: pointer;
    position: absolute;
    top: 0;
    height: 100%;
    z-index: 3;
    font-size: 0.5em;
    width: 20%;
    background: none;
    border-width: 0;
    border-style: initial;
    border-color: initial;
    border-image: initial;

    &:focus,
    &:active {
      outline: none;
    }
  }

  .gallery-control--prev {
    left: 0;

    svg {
      float: right;
    }
  }

  .gallery-control--next {
    right: 0;

    svg {
      float: left;
    }
  }

  @media (max-width: 767px) {
    .gallery-control {
      width: 10%;
    }
  }

  @media (min-width: 1128px) {
    .gallery-control {
      width: 10%;
      font-size: medium;
    }
  }
}

.gallery-modal .gallery {
  display: table-cell;
  vertical-align: middle;
  height: 100%;
  padding-bottom: 0;
}

.gallery-figcaption {
  background-image: none;
  background-color: transparent;
  position: relative;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2;
  text-align: center;
  color: rgb(255, 255, 255);
  overflow: hidden;
  border-radius: 0;

  .gallery-figcaption--thumbnails {
    position: relative;
    height: 58px;
    overflow: hidden;
    transition: 0.45s ease-in-out all;

    .caption-thumbnails {
      position: absolute;
      min-width: 100%;
      margin-left: -4px;
      margin-right: -4px;

      ul.thumbnails-list {
        position: absolute;
        list-style-type: none;
        margin: 0;
        padding: 0;
        left: 0;
        transition: margin 0.3s ease-out 0s;

        &::after,
        &::before {
          content: "";
          display: table;
        }

        &::after {
          clear: both;
        }

        li {
          float: left;

          + li {
            margin-left: 10;
          }

          button.thumbnail-button {
            cursor: pointer;
            position: relative;
            display: block;
            overflow: hidden;
            background: transparent;
            margin: 0;
            padding: 0;

            &:focus,
            &:active {
              outline: none;
            }

            &.active {
              cursor: default;
            }

            &::after,
            &::before {
              border-radius: 50%;
            }

            div.picture {
              border-radius: 4px;
              border: 4px solid transparent;
              overflow: hidden;

              img.thumbnail {
                width: 100%;
                height: 100%;
                display: block;
                position: relative;
                z-index: 1;
                opacity: 0.3;
                filter: alpha(opacity=30);
                backface-visibility: hidden;
                object-fit: cover;
                border-radius: 4px;
                transition: 0.1s ease opacity;
              }
            }

            div.loading-spinner {
              position: absolute;
              z-index: 1001;
              width: 2em;
              height: 2em;
              top: 50%;
              left: 50%;
              margin: -1em 0 0 -1em;
              border-top-width: 0.15em;
              border-right-width: 0.15em;
              border-bottom-width: 0.15em;
              border-left-width: 0.15em;
              transform: translate(-50%, -50%);
            }

            &:hover div.picture img.thumbnail,
            &.active div.picture img.thumbnail {
              opacity: 1;
              filter: alpha(opacity=100);
            }
          }
        }
      }
    }
  }

  &.hide .gallery-figcaption--thumbnails {
    height: 0;
  }
}

.mode-light .gallery-figcaption {
  color: #111;
}

.gallery-figcaption--content {
  max-width: 105vh;
  margin-left: auto;
  margin-right: auto;
  overflow: hidden;
}

.gallery-figcaption--inner {
  margin-left: auto;
  margin-right: auto;
  position: relative;
  transform: translateY(0);
  transition: -ms-transform 0.2s ease-out 0s, -webkit-transform 0.2s ease-out 0s, transform 0.2s ease-out 0s;
}

.hide .gallery-figcaption--inner {
  transform: translateY(70);
}

.gallery-figcaption--info {
  display: table;
  width: 100%;

  .caption-left {
    text-align: left;
    vertical-align: middle;
    display: table-cell;
  }

  .caption-right {
    text-align: right;
    vertical-align: middle;
    display: table-cell;
  }

  .photo-caption,
  .photo-subcaption {
    margin: 0;
    line-height: 1.31;
  }

  .photo-caption {
    font-weight: 500;
    font-size: 1rem;
  }

  .photo-subcaption {
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.851rem;
  }
}

.mode-light .gallery-figcaption--info .photo-subcaption {
  color: rgba(0, 0, 0, 0.65);
}

.gallery-figcaption .gallery-thumbnails--toggle {
  cursor: pointer;
  background: transparent;
  border: 0;
  margin: 0;
  padding: 0;
  vertical-align: bottom;
  display: inline-block;
  color: inherit;
  font-weight: 400;
  font-size: 0.9rem;
  position: relative;

  &:focus,
  &:active {
    outline: none;
  }
}

.gallery-figcaption .gallery-thumbnails--toggle::after {
  content: "";
  display: inline-block;
  vertical-align: middle;
  margin-left: 0.181rem;
}

.gallery-figcaption .gallery-thumbnails--toggle.hide::after {
  border-top: 6px solid #fff;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
}

.mode-light .gallery-figcaption .gallery-thumbnails--toggle.hide::after {
  border-top-color: #111;
}

.gallery-figcaption .gallery-thumbnails--toggle.open::after {
  border-bottom: 6px solid #fff;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
}

.mode-light .gallery-figcaption .gallery-thumbnails--toggle.open::after {
  border-bottom-color: #111;
}

.gallery-modal--close {
  position: absolute;
  z-index: 10;
  right: 0;
  top: 0;
  padding: 15px;
}

.gallery-modal--close button.gallery-close {
  cursor: pointer;
  background: none transparent;
  border: 0;
  display: block;
  padding: 0.5rem;

  &:active,
  &:focus {
    outline: none;
  }
}

.gallery ul.gallery-images--ul li.gallery-media-photo.loading::before {
  z-index: 999;
  content: "";
  display: block;
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 1);
}

.mode-light .gallery ul.gallery-images--ul li.gallery-media-photo.loading::before {
  background-color: rgba(255, 255, 255, 1);
}

/* gallery animation */
.gallery__animation-appear {
  opacity: 0.01;
  transform: translateZ(0);
}

.gallery__animation-appear-active {
  opacity: 1;
  transition: opacity 150ms ease-out;
}

.gallery__image-transition--backwards-enter {
  opacity: 0.01;
  transform: translateX(-5px);
}

.gallery__image-transition--forwards-enter {
  opacity: 0.01;
  transform: translateX(5px);
}

.gallery__image-transition--backwards-enter-active,
.gallery__image-transition--forwards-enter-active {
  opacity: 1;
  transform: translateX(0);
  transition: opacity 150ms ease-out, transform 150ms ease-out;
}

.gallery__image-transition--backwards-leave,
.gallery__image-transition--forwards-leave {
  opacity: 1;
  transform: translateZ(0);
}

.gallery__image-transition--backwards-leave-active,
.gallery__image-transition--forwards-leave-active {
  opacity: 0.01;
  transition: opacity 150ms ease-out;
}

@media (max-width: 743px) {
  .gallery-figcaption--info {
    padding-bottom: 1rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .gallery-figcaption .gallery-figcaption--info {
    display: block;

    .caption-left,
    .caption-right {
      display: block;
      text-align: left;
    }
  }
}

@media (max-width: 743px) {
  .gallery-figcaption--info {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }
}

@media (min-width: 744px) {
  .gallery .gallery-photo {
    padding-bottom: 67%;
  }

  .gallery-figcaption--info {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }
}
